//
//  OAacountSetCell.m
//  LongOA
//
//  Created by 耿用强 on 15/7/5.
//  Copyright (c) 2015年 耿用强. All rights reserved.
//

#import "OAacountSetCell.h"
#import "OAAccount.h"

@implementation OAacountSetCell
{
    UILabel*_nameLabel;
    UILabel*_stateLabel;
}
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor=[UIColor clearColor];
        self.selectionStyle=UITableViewCellSelectionStyleNone;
        _nameLabel=[[UILabel alloc]init];
        _nameLabel.font=FONT_16;
        _nameLabel.backgroundColor=[UIColor clearColor];
        _nameLabel.textColor=[UIColor darkGrayColor];
        [self addSubview:_nameLabel];
        
        _stateLabel=[[UILabel alloc]init];
        _stateLabel.backgroundColor=[UIColor clearColor];
        _stateLabel.textColor=[UIColor greenColor];
        _stateLabel.font=FONT_14;
        [self addSubview:_stateLabel];
        
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    _nameLabel.frame=CGRectMake(RESIZE_UI(20), 0, self.width-RESIZE_UI(40), self.height/2);
    
    _stateLabel.frame=CGRectMake(_nameLabel.left, _nameLabel.bottom+RESIZE_UI(2), _nameLabel.width, RESIZE_UI(18));
    
}

- (void)showCellData:(OAAccount *)dic
{
    _nameLabel.text=dic.name;
    if (dic.hasLogin) {
        _stateLabel.text = [[NSString alloc] initWithFormat:@"%@%@", @"已登录", dic.username];
    }
    else{
        _stateLabel.text = @"未登录";
    }
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
